﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Activities;
using System.Diagnostics;

namespace TeamDeploy.Activities.Test
{
    [TestClass]
    public class RemoteExecuteTests
    {
        [TestMethod]
        public void ExecuteAndVerifyCalc()
        {

            var workflow = new RemoteExecute();
            workflow.TargetMachine = Environment.MachineName;
            workflow.RemoteExecutePathFilename = @"c:\pstools\psexec2.exe";
            workflow.RemoteCommand = "Notepad.exe";

            var workflowInvoker = new WorkflowInvoker(workflow);

            workflowInvoker.Invoke();

            Assert.IsTrue(Process.GetProcessesByName("Notepad.exe") != null);

            var killProcessWorkflow = new KillProcess();
            killProcessWorkflow.TargetMachine = Environment.MachineName;
            killProcessWorkflow.KillAppPathFilename = @"c:\pstools\pskill2.exe";
            killProcessWorkflow.ProcessName = "Notepad.exe";

            WorkflowInvoker  workflowInvoker2 = new WorkflowInvoker(killProcessWorkflow);
            workflowInvoker2.Invoke();
        }
    }
}
